package xyz.xmh.pattern.j2ee.frontcontrollerpattern;

/**
 * 调度器
 *
 * @author admin
 */
public class Dispatcher {


    private static final String STUDENT = "student";
    private final HomeView homeView;
    private final StudentView studentView;

    public Dispatcher() {
        this.homeView = new HomeView();
        this.studentView = new StudentView();
    }

    /**
     * 调度器根据请求响应视图
     *
     * @param request 请求
     */
    public void dispatch(String request) {
        if (Dispatcher.STUDENT.equalsIgnoreCase(request)) {
            studentView.show();
        }
        else {
            homeView.show();
        }

    }
}
